window.addEventListener('load', function () {
    //左侧tab栏选择样式
    var side_nav_bar_list = document.querySelector('.side-nav-bar-list')
    var lis = side_nav_bar_list.querySelectorAll('li')  
    var none = side_nav_bar_list.querySelectorAll('.none')
    var block = side_nav_bar_list.querySelectorAll('.block')
    var categoryName = document.querySelector('#categoryName')
    var helper = document.querySelectorAll('.helper')
    var helping_crumbs=document.querySelectorAll('.helping_bread_crumbs')
    var main_list = document.querySelectorAll('.help-main-title-list')
    var help_game = document.querySelectorAll('.help-center-game')
    for (var i = 0; i < lis.length; i++) {
        lis[i].setAttribute('page_index', i)
        lis[i].addEventListener('click', function (e) { 
            for (var i = 0; i < lis.length;i++) {
                lis[i].className = ''
                helper[i].style.display = 'none'
                
            }
                this.className='active' 
            categoryName.innerHTML = this.children[2].innerHTML
            helper[this.getAttribute('page_index')].style.display = 'block'
            
             //点击样式
            var main_list_lis =main_list[this.getAttribute('page_index')].querySelectorAll('li')
            var stepTag = helping_crumbs[this.getAttribute('page_index')].querySelector('#stepTag')
            var item_box_dad = help_game[this.getAttribute('page_index')].querySelectorAll('.item-box-dad')
            for (var i = 0; i < main_list_lis.length; i++) {
                main_list_lis[i].setAttribute('index', i)
                main_list_lis[i].className = ''
                main_list_lis[0].className='current'
                main_list_lis[i].addEventListener('click', function (e) {
            for (var i = 0; i < main_list_lis.length; i++) {
                main_list_lis[i].className = ''
                item_box_dad[i].style.display='none'
            }
                this.classList = 'current'
                stepTag.innerHTML = this.innerHTML
                item_box_dad[this.getAttribute('index')].style.display='block'
        })
    }
        })    
    }
    lis[0].click();

    
    // 获取客服点击属性
    var side_nav_customer = document.querySelector('.side-nav-customer')
    var newmodal = side_nav_customer.querySelector('.newmodal')
    var customer_service = document.querySelector('.customer-service')
    // 获取发送变色属性
    var footer1_content = document.querySelector('.footer1-content')
    var js_inputMsg = footer1_content.querySelector('#js-inputMsg')
    var sendBtn = footer1_content.querySelector('.sendBtn')
    //客服窗口弹出
    newmodal.addEventListener('click', function () {
        customer_service.style.height = 720 + 'px'
        // 发送变色功能 
        js_inputMsg.addEventListener('keyup', function () {
            if (js_inputMsg.value) {
                sendBtn.style.backgroundColor = '#666'
            } else {
                sendBtn.style.backgroundColor = '#e0e9e8'
               
            }
        })
        
    })
    var toolBar =document.querySelector('.toolBar')
    //关闭声音
    var zhichiVoice = toolBar.querySelector('.zhichiVoice')
    var num = 0;
    zhichiVoice.addEventListener('click', function () {
        if (num === 0) {
            this.style.backgroundPosition = '-501px 0px'
            num = 1;
        } else {
            this.style.backgroundPosition = '-581px 0px'
            num = 0;
        }
    })
    //隐藏弹出框
    var zhichiMin = toolBar.querySelector('.zhichiMin')
    zhichiMin.addEventListener('click', function () {
        customer_service.style.height = 0 + 'px'
    })
    //删除弹出框
    var closeForm = toolBar.querySelector('.closeForm')
    closeForm.addEventListener('click', function () {
        customer_service.style.height = 0 + 'px'
    })
    // 历史记录
    var historyTrigger = document.querySelector('.historyTrigger')
    historyTrigger.addEventListener('click', function () {
        historyTrigger.innerHTML='没有更多'
    })
    
})